<script>
import config from "./http/config";
export default {
  onLaunch: function () {
    // 获取code
    uni.login({
      success: (res) => {
        if (res?.code) {
          uni.request({
            url: config.baseURL + "/login/wx/login",
            method: "POST",
            data: {
              code: res.code,
            },
            header: {
              "content-type": "application/json",
              Authorization: "Basic",
            },
            success: (res) => {
              if (res?.data?.code === 0) {
                uni.setStorageSync("openid", res.data.data.openid || "");
              }
            },
          });
        }
      },
      fail: (err) => {
        console.log(err);
      },
    });
  },
  onShow: function () {
    console.log("App Show");
  },
  onHide: function () {
    console.log("App Hide");
  },
};
</script>

<style lang="scss">
/*每个页面公共css */
@import "uview-ui/index.scss";
/* 在全局样式文件中添加以下CSS规则 */
.u-tabbar__content,
.u-tabbar__content__item-wrapper {
  height: 60px !important;
}
</style>

